<?php
/**
 * 昨天
*/

namespace houze\mongodb\query;

class yesterday {
    /**
     * 构造时间查询
    */
    public static function run($field, $where, $data) {
        $startFix = ' 00:00:00';
        $endFix = ' 23:59:59';
        $day = date('Y-m-d');
        
        $start = strtotime($day.$startFix)-86400;
        $end = strtotime($day.$endFix)-86400;

        return [
            [
                'field' => $field,
                'where' => '>=',
                'value' => $start,
            ],
            [
                'field' => $field,
                'where' => '<',
                'value' => $end,
            ],
        ];
    }
}